import requests

#  http://10.10.1.1/index.php/Home/user/login.html
# url = '''http://10.10.1.1/index.php/Home/Goods/search.html?q=iphone'''  # 查询
# url = '''http://10.10.1.1/index.php/Home/Goods/search.html'''  # 查询
# response = requests.get(url, params="q=iphone")
#
# print(response.encoding)
# response.encoding = "utf-8"
# print(response.encoding)
# print(response.url)
# print(response.text)

# login_url = '''http://10.10.1.1/index.php?m=Home&c=User&a=do_login'''
# login_data = {
#     "username": "18177542579",
#     "password": "123456",
#     "verify_code": "8888"
# }
#
# login_url = "http://10.10.1.1/index.php?m=Home&c=User&a=do_login"
# login_data = {
#     'username': "18177542589",
#     'password': "123456",
#     'verify_code': '8888'
# }
#
# respone = requests.post(url=login_url, data=login_data)
#
# print(respone.json())

# login_url = "http://www.baidu.com"
#
# respone = requests.get(url=login_url)
# respone.encoding = "utf-8"
# print(respone.status_code)
# print(respone.cookies)
# print(respone.cookies.get("BDORZ"))
# print(respone.text)
# print(respone.content)
# print(respone.content.decode("utf-8"))

# url = '''https://weathernew.pae.baidu.com/weathernew/pc?query=%E5%B9%BF%E4%B8%9C%E4%B8%9C%E8%8E%9E%E5%A4%A9%E6%B0%94&srcid=4982'''
#
# response = requests.get(url)
# print(response.headers)
# print(response.headers.get("Content-Type"))
# # print(response.text)
#
# # print(response.json())

session = requests.Session()

url = '''http://10.10.1.1/index.php?m=Home&c=User&a=verify'''
login_data = {
    'username': "18177542589",
    'password': "123456",
    'verify_code': '8888'
}

response = session.get(url)

# print(response.cookies)
# PHPSESSID = response.cookies.get("PHPSESSID")
# print(PHPSESSID)


login_url = '''http://10.10.1.1/index.php?m=Home&c=User&a=do_login'''
login_data = {
    'username': "18177542589",
    'password': "123456",
    'verify_code': '8888'
}


response = session.post(url=login_url, data=login_data)

print(response.json())

url11 = '''http://10.10.1.1/index.php/Home/Order/order_list.html'''

response = session.get(url=url11)

print(response.text)







